package cn.rulian.car.outbill.bo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import cn.rulian.base.common.bo.BaseBo;
import cn.rulian.car.car.bo.Car;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 车辆外出登记单
 */
@Entity
@Table(name = "car_outbill_outbill")
public class OutBill extends BaseBo {
	
	public static String DATASOURCE_APPLE="申请";
	public static String DATASOURCE_ADD="登记";

	@ManyToOne
	@JoinColumn(name = "car_id")
	private Car car; //车辆信息

	@Column(length = 50)
	private String driver; //司机
	
	@Column(length = 100)
	private String  carStatus; //车辆状况
	
	@ManyToOne
	@JoinColumn(name = "organ_id")
	private UseOrgan organ; //用车部门
	
	@Column(length = 50)
	private String user; //用车人
	
	@Column(length = 50)
	private String approver; //审批人
	
	@Column(length = 100)
	private String destination; //目的地

	@JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8") //json格式化输出，列表显示时用
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm") //Spring MVC格式转换：增加、修改时，向后台传送数据时用
	private Date beginTime; //开始时间

	@JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8") //json格式化输出，列表显示时用
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm") //Spring MVC格式转换：增加、修改时，向后台传送数据时用
	private Date endTime; //结束时间
	
	private Double useTime; //使用时长(小时，保留一位小数)
	
	private Integer beginNum; //开始里程
	
	private Integer endNum; //结束里程
	
	private Integer useNum; //使用里程
	
	private Double waitTime; //等待时间(小时，保留一位小数)
	
	private Double fuelNum; //加油费
	
	private Double otherFee; //其他费用（过路费、停车费）
	
	private Double allFee; //全部费用
	
	@Column(length = 200)
	private String remark; //备注
	
	@ManyToOne
	@JoinColumn(name = "state_id")
	private OutBillState state; //状态（草稿、待审核、待回录、完成、退回）
	
	@JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8")
	private Date addTime; //登记时间
	
	//----------------------- add new --------------------------
	
	@Column(length = 20)
	private String dataSource; //数据来源（申请、登记）
	
	private Long applyUserId; //申请用户ID
	
	@Column(length = 50)
	private String applyUserName; //申请用户姓名

	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date opeTimeNear; //最近操作时间

	public Car getCar()
	{
		return car;
	}

	public void setCar(Car car)
	{
		this.car = car;
	}

	public String getDriver()
	{
		return driver;
	}

	public void setDriver(String driver)
	{
		this.driver = driver;
	}

	public String getCarStatus()
	{
		return carStatus;
	}

	public void setCarStatus(String carStatus)
	{
		this.carStatus = carStatus;
	}

	public String getUser()
	{
		return user;
	}

	public void setUser(String user)
	{
		this.user = user;
	}

	public String getDestination()
	{
		return destination;
	}

	public void setDestination(String destination)
	{
		this.destination = destination;
	}

	public Date getBeginTime()
	{
		return beginTime;
	}

	public void setBeginTime(Date beginTime)
	{
		this.beginTime = beginTime;
	}

	public Date getEndTime()
	{
		return endTime;
	}

	public void setEndTime(Date endTime)
	{
		this.endTime = endTime;
	}

	public Double getUseTime()
	{
		return useTime;
	}

	public void setUseTime(Double useTime)
	{
		this.useTime = useTime;
	}

	public void setWaitTime(Double waitTime)
	{
		this.waitTime = waitTime;
	}

	public Integer getBeginNum()
	{
		return beginNum;
	}

	public void setBeginNum(Integer beginNum)
	{
		this.beginNum = beginNum;
	}

	public Integer getEndNum()
	{
		return endNum;
	}

	public void setEndNum(Integer endNum)
	{
		this.endNum = endNum;
	}

	public Integer getUseNum()
	{
		return useNum;
	}

	public void setUseNum(Integer useNum)
	{
		this.useNum = useNum;
	}

	public Double getWaitTime()
	{
		return waitTime;
	}

	public Double getFuelNum()
	{
		return fuelNum;
	}

	public void setFuelNum(Double fuelNum)
	{
		this.fuelNum = fuelNum;
	}

	public Double getOtherFee()
	{
		return otherFee;
	}

	public void setOtherFee(Double otherFee)
	{
		this.otherFee = otherFee;
	}

	public String getRemark()
	{
		return remark;
	}

	public void setRemark(String remark)
	{
		this.remark = remark;
	}

	public String getApprover()
	{
		return approver;
	}

	public void setApprover(String approver)
	{
		this.approver = approver;
	}

	public Date getAddTime()
	{
		return addTime;
	}

	public void setAddTime(Date addTime)
	{
		this.addTime = addTime;
	}

	public Double getAllFee()
	{
		return allFee;
	}

	public void setAllFee(Double allFee)
	{
		this.allFee = allFee;
	}

	public String getDataSource()
	{
		return dataSource;
	}

	public void setDataSource(String dataSource)
	{
		this.dataSource = dataSource;
	}

	public Long getApplyUserId()
	{
		return applyUserId;
	}

	public void setApplyUserId(Long applyUserId)
	{
		this.applyUserId = applyUserId;
	}

	public String getApplyUserName()
	{
		return applyUserName;
	}

	public void setApplyUserName(String applyUserName)
	{
		this.applyUserName = applyUserName;
	}

	public Date getOpeTimeNear()
	{
		return opeTimeNear;
	}

	public void setOpeTimeNear(Date opeTimeNear)
	{
		this.opeTimeNear = opeTimeNear;
	}

	public UseOrgan getOrgan()
	{
		return organ;
	}

	public void setOrgan(UseOrgan organ)
	{
		this.organ = organ;
	}

	public OutBillState getState()
	{
		return state;
	}

	public void setState(OutBillState state)
	{
		this.state = state;
	}
	
}
